package com.ying.tests.AAAmode.proxy.controller.handler;

import com.ying.common.entity.Response;
import org.aspectj.lang.annotation.AfterThrowing;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;

@Aspect
public class GlobalControllerAspect {

    /**
     * 点切面
     */
    @Pointcut("@annotation(org.springframework.web.bind.annotation.RequestMapping))")
    private void pointcut() {

    }

    /**
     * 处理异常
     */
    @AfterThrowing(pointcut = "pointcut()", throwing = "e")
    public Response handleException(Exception e) {
        return new Response().failure(e.getMessage());
    }


}
